#!/usr/bin/env python
# -*-coding:utf-8-*-
# File    : liyuqi.py

import csv
import pytest

#被测试函数
def plus(num1, num2):
    return num1 + num2

#从csv文件读取测试数据
def read_csv():
    with open("data.csv", "r") as f:
        reader = csv.reader(f)
        next(reader)  # 为了跳过首行
        result = list(map(lambda x:[int(i) for i in x], reader)) #读取所有数据并转换为整型
    return result


@pytest.mark.parametrize("exp", read_csv())
def test_plus(exp):
    assert plus(exp[0], exp[1]) == exp[-1]